<template>
  <div class="rankin">
    <!-- 四大模块 -->
    <div
      class="box"
      v-for="(item, index) in musicList"
      :key="index.id"
      v-show="index < 4"
    >
      <!-- 左 -->
      <div class="contenter" @click="toDetail(item.id)">
        <p
          class="van-ellipsis"
          v-for="(data, index) in item.tracks"
          :key="index"
        >
          <big>{{ index + 1 }}</big
          >.{{ data.first }}-{{ data.second }}
        </p>
      </div>
      <!-- 右 -->
      <div class="img" @click="toDetail(item.id)">
        <div class="mask">
          <img :src="logoimg" style="width: 60px; height: 16px" />
        </div>
        <img :src="item.coverImgUrl + '?param=200y200'" alt="" />
        <span class="tag">{{ item.updateFrequency }}</span>
      </div>
    </div>
  </div>
</template>
<script>
import logoimg from "@/assets/logo.png";
export default {
  name: "MusicRankings",
  props: ["musicList"],
  components: {},
  data() {
    return {
      logoimg,
    };
  },
  mounted() {},
  methods: {
    toDetail(id) {
      this.$router.push({
        path: "/MusicDetail",
        query: { id },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.rankin {
  background: #ffffff;
  .box:nth-child(odd) {
    background-color: #fafafa;
  }
  .box:nth-child(even) {
    background-color: #fafafa;
  }
  .box {
    display: flex;
    margin: 0 0.625rem;
    margin-bottom: 0.625rem;
    .img {
      position: relative;
      width: 7.5rem;
      height: 7.5rem;
      z-index: 2;
      .mask {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 4;
        background-image: -webkit-linear-gradient(top, black, transparent);
        img {
          display: block;
          position: absolute;
          left: 50%;
          transform: translateX(-50%);
          top: 30%;
          z-index: 5;
          opacity: 1;
        }
      }
      img {
        display: block;
        border-radius: 0 1rem 1rem 0;
        width: 100%;
        height: 100%;
        position: absolute;
        z-index: 1;
      }
      .tag {
        position: absolute;
        right: 0.125rem;
        top: 0.125rem;
        color: white;
        opacity: 0.88;
        font-size: 0.75rem;
        z-index: 5;
      }
    }
    .contenter {
      flex: 1;
      padding: 0.625rem;
      color: rgba(26, 26, 26, 1);
      p {
        line-height: 1.875rem;
        text-align: left;
        width: 12.5rem;
        font-weight: 300;
        color: #5f6368;
        big {
          color: #11bf72;
        }
      }
    }
  }
}
</style>